<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>index</title>
  <link href="css/bootstrap-4.3.1.css" rel="stylesheet" type="text/css">
  <link href="css/index.css" rel="stylesheet" type="text/css">
  <link href="css/comm.css" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="https://cdn.staticfile.net/font-awesome/4.7.0/css/font-awesome.css" />
  <style>
    .container-fix {
      height: 768px !important;
    }

    @media (max-width:768px) {
      .container-fix {
        height: 384px !important;
      }
    }
  </style>
</head>

<body style="background-color: #eee;font-family: Arial, sans-serif;">
  <div class="j-nav">
    <div class="j-container">
      <div class="logoimg"> <img src="images/111.png" height="75%" alt="" class="mt-1 mr-5"> </div>
      <div class="nav-list app-display-none"> <a href=""><span class="j-fs-9rem">首页</span></a> <a
          href="https://gitee.com/cvscloud/xiaozu-kaifa/tree/master/qimozy" target="_blank"><span
            class="j-fs-9rem">代码仓库</span></a> </div>
      <a href="#" style="text-decoration: none;" class="userinfo app-display-none"> <i class="fa fa-user-circle-o"
          style="font-size:26px;display: block;float: left"></i> <img class="userImg"
          src="https://ui-avatars.com/api/?name=Ben&length=1&rounded=true&background=0D8ABC&color=fff&font-size=0.65"
          width="30px" height="30px" alt="" style="display: none;float: left"> <span class="username ml-1 mt-1"
          style=""></span> </a>
      <div class="app-open-nav j-flex j-align-items-center j-justify-content-around app-display-block"> <i
          class="fa fa-list opocl-nav" style="font-size:30px"></i> </div>
    </div>
  </div>
  <div class="app-nav app-display-block">
    <ul class="app-nav-list">
      <li><a href=""><i class="fa fa-home"></i> 首页</a></li>
      <li><a href="https://gitee.com/cvscloud/xiaozu-kaifa/tree/master/qimozy" target="_blank"><i
            class="fa fa-calendar"></i> 代码仓库</a>
      </li>
      <li class="app-open-course-list"><i class="fa fa-book"></i> 课程列表</li>
    </ul>
    <a href="myinfo.html" style="position: absolute;bottom: 30px;left: 10px;width: 90%">
      <div class="dropdown-divider bg-success"></div>
      <div class="userinfo app-display-block"> <i class="fa fa-user-circle-o"
          style="font-size:26px;display: block;float: left"></i> <img class="userImg"
          src="https://ui-avatars.com/api/?name=Ben&length=1&rounded=true&background=0D8ABC&color=fff&font-size=0.65"
          width="30px" height="30px" alt="" style="display: none;float: left"> <span
          class="username ml-1 mt-1">Ben</span> </div>
    </a>
  </div>
  <div class="container-fluid">
    <div class="j-container" style="margin-top: 100px;">
      <div class="banner-box">
        <div class="course-list app-display-none">
          <h5 class="text-center text-light app-display-none" style="padding: 10px 0">课程列表</h5>
          <h6 class="text-light app-display-block" style="padding: 10px 15px">课程列表<span style="float:right"
              class="app-close-list"><i class="fa fa-close" style="font-size:20px"></i> </span></h6>
          <ul>
            <li style="padding-top: 0">Web前端开发技术<span>学习</span></li>
            <li>软件测试技术<span>学习</span></li>
            <li>数据库应用<span>学习</span></li>
            <li>后端开发与实战<span>学习</span></li>
            <li>程序设计基础<span>学习</span></li>
            <li>Web前端开发技术<span>学习</span></li>
            <li>软件测试技术<span>学习</span></li>
            <li>数据库应用<span>学习</span></li>
            <li>后端开发与实战<span>学习</span></li>
            <li>程序设计基础<span>学习</span></li>
          </ul>
        </div>
        <div class="banner">
          <div class="banner-test">
            <div class="banner-con">
              <div><img src="images/444.jpg" alt="" width="100%" height="100%" class="banner-img"></div>
              <div><img src="images/555.jpg" alt="" width="100%" height="100%" class="banner-img"></div>
              <div><img src="images/666.jpg" alt="" width="100%" height="100%" class="banner-img"></div>
              <div><img src="images/888.jpg" alt="" width="100%" height="100%" class="banner-img"></div>
            </div>
            <span
              class="banner-btn pre j-flex j-align-items-center j-justify-content-center font-weight-bold text-light"><i
                class="fa fa-angle-double-left" style="font-size:36px"></i></span> <span
              class="banner-btn next j-flex j-align-items-center j-justify-content-center font-weight-bold text-light"><i
                class="fa fa-angle-double-right" style="font-size:36px"></i></span>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="container-fluid test"></div>
  <div class="j-container" style="margin-top: 70px">
    <h5 style="padding-left: 40px;float: left">我的课程</h5>
    <div class="container-fluid">
      <div class="container-fluid card-list j-flex j-justify-content-center">
        <p style="font-size: .8rem;display: none" class="text-secondary text-center" id="myCourse">暂无课程,去<a
            href="coursePage.html">添加课程</a>学习!</p>
        <p style="font-size: .8rem;display: none" class="text-secondary text-center" id="iflogin">您尚未<a
            href="loginPage.html">登录</a></p>
        <div class="card-box linkMy"> <img src="images/file1.png" width="100%" height="auto" alt=""
            style="border-radius: 10px" class="card-img">
          <h6 class="font-weight-bold mt-4">'+allcourse[i]['asCourse'][0]['course_name']+'</h6>
          <p>

            <span>授课教师：'+allcourse[i]['asCourse'][0]['course_teacher']+'</span><br>
            <span>结课：2024-05-18~2024-05-18</span>
          </p>
        </div>
        <div class="card-box linkMy"> <img src="images/file1.png" width="100%" height="auto" alt=""
            style="border-radius: 10px" class="card-img">
          <h6 class="font-weight-bold mt-4">'+allcourse[i]['asCourse'][0]['course_name']+'</h6>
          <p>

            <span>授课教师：'+allcourse[i]['asCourse'][0]['course_teacher']+'</span><br>
            <span>结课：2024-05-18~2024-05-18</span>
          </p>
        </div>
        <div class="card-box linkMy"> <img src="images/file1.png" width="100%" height="auto" alt=""
            style="border-radius: 10px" class="card-img">
          <h6 class="font-weight-bold mt-4">'+allcourse[i]['asCourse'][0]['course_name']+'</h6>
          <p>

            <span>授课教师：'+allcourse[i]['asCourse'][0]['course_teacher']+'</span><br>
            <span>结课：2024-05-18~2024-05-18</span>
          </p>
        </div>
      </div>
    </div>
  </div>
  <div class="container-fluid">
    <div class="j-container j-mt70">
      <h5 style="padding-left: 30px " >全部课程</h5>
      <div class="container-fluid card-list j-flex j-justify-content-center">
        <p style="font-size: .8rem;display: none" class="text-secondary text-center" id="allCourse">暂无课程</p>
        <div class="card-box linkMy"> <img src="images/file1.png" width="100%" height="auto" alt=""
            style="border-radius: 10px" class="card-img">
          <h6 class="font-weight-bold mt-4">'+allcourse[i]['asCourse'][0]['course_name']+'</h6>
          <p>

            <span>授课教师：'+allcourse[i]['asCourse'][0]['course_teacher']+'</span><br>
            <span>结课：2024-05-18~2024-05-18</span>
          </p>
        </div>
        <div class="card-box linkMy"> <img src="images/file1.png" width="100%" height="auto" alt=""
            style="border-radius: 10px" class="card-img">
          <h6 class="font-weight-bold mt-4">'+allcourse[i]['asCourse'][0]['course_name']+'</h6>
          <p>

            <span>授课教师：'+allcourse[i]['asCourse'][0]['course_teacher']+'</span><br>
            <span>结课：2024-05-18~2024-05-18</span>
          </p>
        </div>
        <div class="card-box linkMy"> <img src="images/file1.png" width="100%" height="auto" alt=""
            style="border-radius: 10px" class="card-img">
          <h6 class="font-weight-bold mt-4">'+allcourse[i]['asCourse'][0]['course_name']+'</h6>
          <p>

            <span>授课教师：'+allcourse[i]['asCourse'][0]['course_teacher']+'</span><br>
            <span>结课：2024-05-18~2024-05-18</span>
          </p>
        </div>
      </div>
    </div>
  </div>
  <div class="container container-fix">
    <iframe src="//player.bilibili.com/player.html?bvid=BV1dwhFe8Eom&page=1" scrolling="no" border="0" frameborder="no"
      framespacing="0" allowfullscreen="true" width="100%" height="100%"> </iframe>
  </div>
  <div class="container-fluid mt-5 bg-light" style="margin-bottom: -15px;">
    <p class="text-center p-3" style="font-size: .7rem">顺职2班第1组</p>
  </div>
  <script src="js/jquery-3.3.1.min.js"></script>
  <script src="js/popper.min.js"></script>
  <script src="js/bootstrap-4.3.1.js"></script>
  <script src="js/ajaxClass.js"></script>
  <script src="js/comm.js"></script>
  <script src="js/home.js"></script>
  <script>

    new createAjax('https://demo.codelover.club/api/curriculum/list', 'get', {}, {}).sendRequest(res => {
      for (let i = 0; i < res['data'].length; i++) {
        let fdata = res['data'][i];
        let allCourseHTML = '';
        let classEndTime = removeAfterChar(fdata['closeChooseTime'], 'T');
        let classStartTime = removeAfterChar(fdata['startTeachingTime'], 'T');
        allCourseHTML += '<div class="card-box linkAll"><input class="cno" value="' + fdata['currNo'] + '" style="display:none"/>';
        allCourseHTML += '<div class="img-box"><img src="' + fdata['iconPath'] + '" alt="" style="border-radius: 10px" class="card-img" loading="lazy"></div>';
        allCourseHTML += '<h6 class="font-weight-bold mt-4">' + fdata['name'] + '</h6><p class="text-secondary">';
        allCourseHTML += '<span>简介：' + fdata['currDesc'] + '</span><br><span>授课教师：' + fdata['tutorStaffUserName'] + '</span><br><span>结课：' + classStartTime + '~' + classEndTime + '</span></p></div>';
        $('#allCourse').after(allCourseHTML);
      }
    })


    if (localStorage.getItem('j_userInfo') !== null) {
      $('#iflogin').css('display', 'none');
      $('.ultips').css('display', 'none');
      var userinfo = JSON.parse(localStorage.getItem('j_userInfo'));

      new createAjax('https://demo.codelover.club/api/choose/mylist', 'get', { 'Authorization': 'Bearer ' + userinfo['accessToken'] }, { 'userID': userinfo['userID'] }).sendRequest(res => {
        console.log(res);
        document.querySelector('.userlink').href = '#';
        document.querySelector('.userImg').src = 'https://ui-avatars.com/api/?name=' + userinfo['realName'] + '&length=1&rounded=true&background=0D8ABC&color=fff&font-size=0.65';
        $('.username').text(userinfo['realName']);
        for (let i = 0; i < res['data'].length; i++) {
          let fdata = res['data'][i];
          let classEndTime = removeAfterChar(fdata['finishTeachingTime'], 'T');
          let classStartTime = removeAfterChar(fdata['openChooseTime'], 'T');

          let myCourseHTML = '';
          myCourseHTML += '<div class="card-box linkAll"><input class="cno" value="' + fdata['currNo'] + '" style="display:none"/>';
          myCourseHTML += '<div class="img-box"><img src="' + fdata['iconPath'] + '" alt="" style="border-radius: 10px" class="card-img" loading="lazy"></div>';
          myCourseHTML += '<h6 class="font-weight-bold mt-4">' + fdata['name'] + '</h6><p class="text-secondary">';
          myCourseHTML += '<span>简介：' + fdata['currDesc'] + '</span><br><span>授课教师：' + fdata['tutorStaffUserName'] + '</span><br><span>结课：' + classStartTime + '~' + classEndTime + '</span></p></div>';
          $('#iflogin').after(myCourseHTML);

          let myCourseList = '';
          myCourseList += '<li>' + fdata['name'] + '<span>学习</span></li>';
          $('.list-ul').append(myCourseList);
        }
      },
        function (jqXHR, textStatus, errorThrown) {
          var statusCode = jqXHR.status;
          $('#iflogin').css('display', 'block');
          $('.ultips').css('display', 'block');
          if (statusCode == 401) console.log('认证过期，建议重新登陆')
        })
    }

    ElementEventFun('click', '.linkAll', function () {
      let currno = $(this).find('.cno').val();
      window.location.href = 'coursePage.html?courseNum=' + currno;
    })
  </script>
</body>

</html>